import Vue from 'vue';
import VueI18n from 'vue-i18n';


import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import ElementLocale from 'element-ui/lib/locale'


Vue.use(VueI18n);


// 准备翻译的语言环境
const messages = {
    zh: {
        // 页面
        menu: {
            home: '首页',
            goods: '商品管理',
            params: '规格与包装',
            specs: '规格管理',
            packing: '包装管理',
            order: '订单管理',
            user: '用户管理',
        },
        btn: {
            edit: '编辑',
            search: '搜索',
            add: '添加',
            del: '删除'
        },
        text: {
            title: '易购后台管理系统',
            international: '国际化',
            welcome: '欢迎',
            goodsplace: '请输入内容',
            
        },
        goodstitle: {
            goodsId: '商品ID',
            goodsName: '商品名称',
            goodsPrice: '商品价格(元)',
            goodsNum: '商品数量',
            goodsCategory: '规格类目',
            goodsImg: '商品图片',
            goodsSellPoint: '商品卖点',
            goodsDesc: '商品描述',
            goodsAction: '操作',
            delText: '此操作将永久删除该数据，确定删除吗？'
        },
        ...zhLocale
    },
    en: {
        menu: {
            home: 'Home',
            goods: 'Goods Manage',
            params: 'Specs And Packing',
            specs: 'Specs Manage',
            packing: 'Packing Manage',
            order: 'Order Manage',
            user: 'User Manage',
        },
        btn: {
            edit: 'Edit',
            search: 'search',
            add: 'add',
            del: 'delete'
        },
        text: {
            title: 'EGO System',
            international: 'International',
            welcome: 'welcome',
            goodsplace: 'Please enter content',
            

        },
        goodstitle: {
            goodsId: 'ID',
            goodsName: 'Name',
            goodsPrice: 'Price(RMB)',
            goodsNum: 'Num',
            goodsCategory: 'Category',
            goodsImg: 'Picture',
            goodsSellPoint: 'SellPoint',
            goodsDesc: 'Describe',
            goodsAction: 'Action',
            delText: 'This operation will permanently delete the data. Are you sure to delete it?',
        },
        ...enLocale
    }
}


// 创建VueI18n实例
const i18n = new VueI18n({
    locale: 'zh',  // 设置地区
    messages: messages  // 设置地区信息
})

ElementLocale.i18n((key, value) => i18n.t(key, value))

export default i18n;